﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Domain.Entities.Auditing;

namespace BW.WMS.WareHouseAllot
{
    /// <summary>
    /// 货品信息实体
    /// </summary>
    [Table("GoodsModel")]
    public class GoodsModel: AuditedAggregateRoot<Guid>
    {
        /// <summary>
        /// 货品编码
        /// </summary>
        [Required(ErrorMessage = "货品编码不能为空")] // 非空约束（提示信息可选）
        [MaxLength(50, ErrorMessage = "货品编码长度不能超过50个字符")] // 最大长度50
        public string GoodsCode { get; set; }

        /// <summary>
        /// 货品名称
        /// </summary>
        [Required(ErrorMessage = "货品名称不能为空")] // 非空约束（提示信息可选）
        [MaxLength(50, ErrorMessage = "货品名称长度不能超过50个字符")] // 最大长度50
        public string GoodsName { get; set; }

        /// <summary>
        /// 货品状态
        /// true: 启用 false: 禁用
        /// </summary>
        public bool GoodsStatus { get; set; }

        /// <summary>
        /// 货品类型（外键）
        /// </summary>
        public Guid GoodsTypeId { get; set; }

        /// <summary>
        /// 货品类型实体
        /// </summary>
        //public GoodsTypeModel GoodsType { get; set; }

        /// <summary>
        /// 货品单位
        /// </summary>
        [Required(ErrorMessage = "货品单位不能为空")] // 非空约束（提示信息可选）
        [MaxLength(10, ErrorMessage = "货品单位长度不能超过10个字符")] // 最大长度50
        public string GoodsUnit { get; set; } 

        /// <summary>
        /// 供应商
        /// </summary>
        public string Supplier { get; set; } = string.Empty;

        /// <summary>
        /// 客户
        /// </summary>
        public string Customer { get; set; } = string.Empty;

        /// <summary>
        /// 仓库id（外键）
        /// </summary>
        public Guid WareHouseId { get; set; } // 仓库ID

        /// <summary>
        /// 入库价格
        /// </summary>
        [Column(TypeName = "decimal(18,2)")]
        public decimal InventoryPrice { get; set; }

        /// <summary>
        /// 出库价格
        /// </summary>
        [Column(TypeName = "decimal(18,2)")]
        public decimal OutboundPrice { get; set; }

        /// <summary>
        /// 库存
        /// </summary>
        [MaxLength(10)]
        public int Inventory { get; set; }

        /// <summary>
        /// 库存总金额
        /// </summary>
        [Column(TypeName = "decimal(18,2)")]
        public decimal SumPrice { get; set; }

        /// <summary>
        /// 保质期
        /// </summary>
        public string Lifetime { get; set; }

        /// <summary>
        /// 保质期管理
        /// false:未开启 true:已开启
        /// </summary>
        public bool LifetimeManage { get; set; }

        /// <summary>
        /// 预警天数
        /// </summary>
        public int EarlyWarningDays { get; set; }

        /// <summary>
        /// 排序
        /// </summary>
        public int Sort { get; set; }

        /// <summary>
        /// 图片
        /// </summary>
        public string Img { get; set; }=string.Empty;

        /// <summary>
        /// 附件文件
        /// </summary>
        public string File { get; set; } = string.Empty;

        /// <summary>
        /// 货品信息备注
        /// </summary>
        [MaxLength(100, ErrorMessage = "货品信息备注长度不能超过100个字符")] // 最大长度100
        public string GoodsNotes { get; set; }

        /// <summary>
        /// 创建人
        /// </summary>
        [MaxLength(30,ErrorMessage = "创建人长度不能超过50个字符")]
        public string CreateName { get; set; }

        /// <summary>
        /// 更新人
        /// </summary>
        [MaxLength(30, ErrorMessage = "更新人长度不能超过50个字符")]
        public string UpdateName { get; set; }=string.Empty;

        /// <summary>
        /// 软删除
        /// false: 未删除 true: 已删除
        /// </summary>
        public bool IsDeleted { get; set; } = false;
    }
}
